package day0721;

import java.util.LinkedList;

public class Test2 {
    public static void main(String[] args) {
        LinkedList<Character>   list=new LinkedList<>();
        list.add('a');
        list.add('b');
        list.add('c');
        boolean flag1=list.add('d');
        System.out.println("字母d添加是否成功："+flag1);
        list.add(0,'e');
        System.out.println(list);

        Character c1=list.remove(0);
        System.out.println("被删除的元素是："+c1);
        System.out.println(list);

        boolean flag2=list.remove(new Character('d'));
        System.out.println("删除元素d是否删除成功：" + flag2);
        System.out.println(list);

        Character c2=list.set(0,'A');
        System.out.println("被替换的元素是：" + c2);
        System.out.println(list);

        char c3=list.get(0);
        //取出的元素是Character类型的对象，复制给char  c3，java会调用系统类库的方法进行自动拆箱
        //(将对象中的成员变量值赋值给基本类型变量char  c3)
        System.out.println(c3);

        boolean flag4=list.contains('b');
        System.out.println(flag4);

        list.clear();
        System.out.println(list);
    }
}
